
{***********************************************************}
{                                                           }
{      Informix esql "varchar.h"                            }
{                                                           }
{      Translated to Object Pascal by                       }
{      Copyright (c) 2001-2008 Luxena Software Company      }
{      http://www.luxena.com                                }
{      e-mail: support@luxena.com                           }
{                                                           }
{***********************************************************}

unit IfxVarChar;

{$I lx.inc}

interface

// VARCHAR macros

const
  MAXVCLEN = 255;


// #define VCLENGTH(len)(VCMAX(len) + 1)
function VCLENGTH(len: Integer): Integer;

// #define VCMIN(size)(((size) >> 8) & 0x00ff)
function VCMIN(size: Integer): Integer;

// #define VCMAX(size)((size) & 0x00ff)
function VCMAX(size: Integer): Integer;

// #defFine VCSIZ(max, min)((((min) << 8) & 0xff00) + ((max) & 0x00ff))
function VCSIZ(max, min: Integer): Integer;


implementation

function VCLENGTH(len: Integer): Integer;
begin
  Result := VCMAX(len) + 1;
end;

function VCMIN(size: Integer): Integer;
begin
  Result := (size shr 8) and $00FF;
end;

function VCMAX(size: Integer): Integer;
begin
  Result := size and $00FF;
end;

function VCSIZ(max, min: Integer): Integer;
begin
  Result := ((min shl 8) and $FF00) + (max and $00FF);
end;

end.